package com.deyuanyun.pic.ctrl.validatefun;

import com.deyuanyun.pic.common.spring.SpringAppliction;
import com.deyuanyun.pic.common.util.web.RequestResponseContext;
import com.deyuanyun.pic.common.validator.vinterface.ValidateInterface;
import com.deyuanyun.pic.ctrl.annotation.DbTable;
import com.deyuanyun.pic.ctrl.service.EQPTBaseService;
import com.deyuanyun.pic.ctrl.service.ImportService;
import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;

/**
 * 模块描述
 *
 * @author scalpel.王敏
 * @version [v1.0] 创建时间（2016/11/5）
 * @see // 引用的类
 * Method List:
 * 1.----------------
 * 2.----------------
 * History:
 */
public class OclpointValid implements ValidateInterface {
    @Override
    public <T, E, C> boolean apply(T t, E e, C c) throws NoSuchFieldException {
        Object obj= c;
        DbTable table=obj.getClass().getAnnotation(DbTable.class);
        Field f=(Field) e;
        String val= (String) t;
        try
        {
           ArrayList<String> number= (ArrayList<String>) RequestResponseContext.getRequest().getAttribute("oclpoint_sessionId");

            if(number.contains(val))
            {
                return false;
            }
            number.add(val);
        }catch (Exception e1)
        {

        }

        return true;
    }

    @Override
    public String getName() {
        return null;
    }
}
